﻿@model GroceryList.Front.Web.ViewModels.ListaCompraDto
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>ViewPage1</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" media="screen" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.datepicker.css")" rel="stylesheet" type="text/css" media="screen" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.theme.css")" rel="stylesheet" type="text/css" media="screen" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.base.css")" rel="stylesheet" type="text/css" media="screen" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript">
    </script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
@*    @using (Html.BeginForm())
    {
*@        @Html.ValidationSummary(true)
        <fieldset>
            <legend>Lista</legend>
            <div class="editor-label">
                @Html.LabelFor(model => model.Nombre)
            </div>
            <div class="editor-field">
                @Html.TextBox("Nombre",Model.Nombre, new { disabled = "disabled" })
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.Fecha)
            </div>
            <div class="editor-field">
                @Html.TextBox("Fecha", Model.Fecha.ToString("dd/MM/yyyy"), new { @class = "date", disabled = "disabled" })
                <script type="text/javascript">

                    $(document).ready(function () {
                        $('.date').datepicker({ dateFormat: "dd/mm/yy" });
                    });    
    
                </script>
            </div>
        </fieldset>    
        <fieldset>
            <legend>Detalles</legend>
            <table>
                @{var @i = 0;}
                @foreach (var item in Model.DetalleProducto)
                {
                    <tr>
                        <td>
                            <input 
                                name="@string.Format("DetalleProducto[{0}].Producto", i)" 
                                type="hidden" 
                                value="@item.Producto" 
                            />
                            <input 
                                type="text" 
                                value="@item.Producto" 
                                disabled="disabled"
                            />
                        </td>
                        <td>
                            <input 
                                name="@string.Format("DetalleProducto[{0}].Cantidad", i)" 
                                type="text" 
                                value="@item.Cantidad"                                 
                                disabled="disabled"
                                style="width:50px;text-align:right"
                                maxlength="4"
                                size="4"
                            />
                        </td>
                        <td>
                            <input 
                                name="@string.Format("DetalleProducto[{0}].Observaciones", i)" 
                                type="text" 
                                value="@item.Observaciones" 
                                disabled="disabled"
                            />
                        </td>
                        <td>
                            @Html.ActionLink(
                                "Comprar", 
                                "Comprar",   // <-- ActionMethod
                                "Compra",  // <-- Controller Name.
                                new { codigoLista =  Model.Codigo,Producto = item.Producto },
                                null
                                )
                        </td>
                        <td>
                            @Html.ActionLink(
                                "Tachar", 
                                "Tachar",   // <-- ActionMethod
                                "Compra",  // <-- Controller Name.
                             new { codigoLista = Model.Codigo, Producto = item.Producto },
                             null
                             )
                        </td>
                    </tr>                                                                                                                 
                    i++;
                }
            </table>
        </fieldset>    
@*        <p>
            <input type="submit" value="Save" />
        </p>
    }
*@</body>
</html>
